/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ggsoft.timetracker.domain;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import org.appfuse.model.User;
import org.hibernate.search.annotations.DocumentId;

/**
 *
 * @author giovanella
 * @date May 17, 2014
 */
@Entity
@Table(name = "timecards")
public class Timecard implements Serializable {

    private Long id;
    private User user;
    private Date date;
    private Date loginTime;
    private Date logoutTime;
    private String reason;
    private Double totalHours;
    private String loginStation;
    private String logoutStation;
    private User createdBy;
    private Date createOn;
    private User modifiedBy;
    private Date modifiedOn;

    public Timecard() {
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @DocumentId
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @ManyToOne
    @JoinColumn(name = "user_id")
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Column(name = "log_date")
    @Temporal(javax.persistence.TemporalType.DATE)
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Column(name = "log_in_time")
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    public Date getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(Date loginTime) {
        this.loginTime = loginTime;
    }

    @Column(name = "log_out_time")
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    public Date getLogoutTime() {
        return logoutTime;
    }

    public void setLogoutTime(Date logoutTime) {
        this.logoutTime = logoutTime;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    @Column(name = "total_hours")
    public Double getTotalHours() {
        return totalHours;
    }

    public void setTotalHours(Double totalHours) {
        this.totalHours = totalHours;
    }
    
    @Column(name = "login_station")
    public String getLoginStation() {
        return loginStation;
    }

    public void setLoginStation(String station) {
        this.loginStation = station;
    }   

    @Column(name = "logout_station")
    public String getLogoutStation() {
        return logoutStation;
    }

    public void setLogoutStation(String logoutStation) {
        this.logoutStation = logoutStation;
    } 

    @ManyToOne
    @JoinColumn(name = "created_by")
    public User getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(User createdBy) {
        this.createdBy = createdBy;
    }        

    @Column(name = "created_on")
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    public Date getCreateOn() {
        return createOn;
    }

    public void setCreateOn(Date createOn) {
        this.createOn = createOn;
    }
    
    @ManyToOne
    @JoinColumn(name = "modified_by")
    public User getModifiedBy() {
        return modifiedBy;
    }

    
    public void setModifiedBy(User modifiedBy) {
        this.modifiedBy = modifiedBy;
    }

    @Column(name = "modified_on")
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    public Date getModifiedOn() {
        return modifiedOn;
    }

    public void setModifiedOn(Date modifiedOn) {
        this.modifiedOn = modifiedOn;
    }
}
